import { Body, Controller, Get, Param, Post } from '@nestjs/common';
import { AppService } from './app.service';

@Controller('/')
export class AppController {
  constructor(private readonly appService: AppService) {}

  @Post('createTask')
  async createOrUpdate(@Body() zh: any): Promise<string> {
    return await this.appService.createOrUpdate(zh);
  }

  @Post('updateEmail/:todesk/:date/:isSendEmail')
  updateZh(
    @Param('todesk') todesk: string,
    @Param('date') date: string,
    @Param('isSendEmail') isSendEmail: string,
  ) {
    return this.appService.updateEmail(todesk, date, isSendEmail);
  }

  @Get('getZh/:date')
  getZh(@Param('date') date: string) {
    return this.appService.getZh(date);
  }

  @Get('sendEmail/:todesk')
  sendEmail(@Param('todesk') todesk: string) {
    return this.appService.sendEmail(todesk);
  }
}
